<?php

namespace Modules\Chinadmin\Http\Controllers\Admin;

use Illuminate\Http\Request;
use Modules\Chinadmin\Models\FormModel;

class Form extends Base
{
    /**
     * 依赖注入
     */
    public function __construct(){
        //自行配制
        $this->models = new FormModel();
        parent::__construct();
    }

    /**
     * 更新
     *
     * http://l.com/chinadmin/form/update
     */
    public function update(Request $request){

        $i = $request->input();

        if(empty($i['table'])){
            mdsResponse(400,"必须有表名!");
        }

        $data['width'] = $i['td_width'];
        $where['field'] = $i['data_field'];
        $where['table_name'] = $i['table'];

        $re = FormModel::where($where)->update($data);

        mds_if_response($re);

    }

}
